package generic_interface

import "fmt"

type Date[T int | string] interface {
	Process(t T) (T, error)
	Save() error
}

type DateString struct{}

func (DateString) Process(t string) (string, error) {
	return " ", nil
}
func (DateString) Save() error { return nil }

type DateInt struct{}

func (DateInt) Process(t int) (int, error) {
	return 0, nil
}
func (DateInt) Save() error { return nil }

func GenericInterfaceInt(t Date[int]) {
	fmt.Println("GenericInterfaceInt(t Date[int])")
}

func GenericInterfaceString(t Date[string]) {
	fmt.Println("GenericInterfaceString(t Date[string])")
}

func GenericInterface() {
	d1 := DateString{}
	d2 := DateInt{}
	GenericInterfaceInt(d2)
	GenericInterfaceString(d1)
}
